package com.bestdreamer.date;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class GetDate {

    public static void main(String[] args) {

        Calendar ca = Calendar.getInstance();
        ca.setTime(new Date());
        ca.add(Calendar.DATE, -1);
        Date date = ca.getTime();
        SimpleDateFormat sf = new SimpleDateFormat("YYYY-MM-dd hh:mm:ss");
        System.out.println(sf.format(date));
    }
}
